home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / tex-k-archive.past / 1994.11.gz / 1994.11 / 000279_owner-test-k@cs.umb.edu_Wed Nov 30 01:20:11 1994.msg < prev    next >
Internet Message Format  |  1994-11-30  |  3KB

  1. Received: by cs.umb.edu id AA01733
  2.   (5.65c/IDA-1.4.4 for tex-k-outgoing); Wed, 30 Nov 1994 06:21:35 -0500
  3. Received: from terminus.cs.umb.edu by cs.umb.edu with SMTP id AA01722
  4.   (5.65c/IDA-1.4.4 for <tex-k-cs@cs.umb.edu>); Wed, 30 Nov 1994 06:21:26 -0500
  5. Received: by terminus.cs.umb.edu id AA17313
  6.   (5.65c/IDA-1.4.4 for tex-k); Wed, 30 Nov 1994 06:20:11 -0500
  7. Date: Wed, 30 Nov 1994 06:20:11 -0500
  8. From: "K. Berry" <kb@cs.umb.edu>
  9. Message-Id: <199411301120.AA17313@terminus.cs.umb.edu>
  10. To: charnier@lirmm.fr
  11. Cc: tex-k@cs.umb.edu, mike@cs.utah.edu
  12. Subject: check SMART_PUTENV under FreeBSD?
  13. Sender: owner-test-k@cs.umb.edu
  14. Precedence: bulk
  15.  
  16.     5) I used SMART_PUTENV, run time error in function assert otherwise.
  17.  
  18. Several people have reported that configure's test for SMART_PUTENV,
  19. contributed by mike@cs.utah.edu, doesn't work.  I don't have FreeBSD, so
  20. can't check myself.
  21.  
  22. The people who have investigated said that taking out the #if 0 and
  23. #endif in the test showed that it was computing the right thing (i.e.,
  24. it printed `#define SMART_PUTENV').  So I am extremely puzzled.  The
  25. only thing that configure cares about is the return status -- supposed
  26. to be zero if SMART_PUTENV, nonzero otherwise.
  27.  
  28. Can you or someone track this down for real?
  29.  
  30. I suppose configure could just check for freebsd, but that seems a poor
  31. solution. Better to discover what is really wrong with the test.
  32.  
  33.  
  34. #define VAR    "YOW_VAR"
  35. #define STRING1 "GabbaGabbaHey"
  36. #define STRING2 "Yow!!"        /* should be shorter than STRING1 */
  37. extern char *getenv (); /* in case char* and int don't mix gracefully */
  38. main ()
  39. {
  40.   char *str1, *rstr1, *str2, *rstr2;
  41.   str1 = getenv (VAR);
  42.   if (str1)
  43.     exit (1);
  44.   str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1);
  45.   if (str1 == 0)
  46.     exit (2);
  47.   strcpy (str1, VAR);
  48.   strcat (str1, "=");
  49.   strcat (str1, STRING1);
  50.   if (putenv (str1) < 0)
  51.     exit (3);
  52.   rstr1 = getenv (VAR);
  53.   if (rstr1 == 0)
  54.     exit (4);
  55.   rstr1 -= strlen (VAR) + 1;
  56.   if (strncmp (rstr1, VAR, strlen (VAR)))
  57.     exit (5);
  58.   str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1);
  59.   if (str2 == 0 || str1 == str2)
  60.     exit (6);
  61.   strcpy (str2, VAR);
  62.   strcat (str2, "=");
  63.   strcat (str2, STRING2);
  64.   if (putenv (str2) < 0)
  65.     exit (7);
  66.   rstr2 = getenv (VAR);
  67.   if (rstr2 == 0)
  68.     exit (8);
  69.   rstr2 -= strlen (VAR) + 1;
  70. #if 0
  71.   printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2);
  72.   /*
  73.    * If string from first call was reused for the second call,
  74.    * you had better not do a free on the first string!
  75.    */
  76.   if (rstr1 == rstr2)
  77.           printf ("#define SMART_PUTENV\n");
  78.   else
  79.           printf ("#undef SMART_PUTENV\n");
  80. #endif
  81.   exit (rstr1 == rstr2 ? 0 : 1);